﻿using SqlSugar;
using System;

namespace Infrastructure
{
    public class SugarDao
    {
      
        private SugarDao()
        {
        }
        public static string ConnectionString
        {
            get
            {
                string reval = Utility.GetConnectionString();
                return reval;
            }
        }
 
        /// <summary>
        /// 创建SqlSugar实例
        /// </summary>
        /// <returns></returns>
        public static SqlSugarClient GetInstance()
        {
            var db = new SqlSugarClient(ConnectionString);
            db.IsEnableLogEvent = true;//Enable log events
            db.LogEventStarting = (sql, par) => { Console.WriteLine(sql + " " + par + "\r\n"); };
            db.IsNoLock = true;
            
            return db;
        }

       
    }
}
